package Game.Items.Potions;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Vector2f;

import GUI.GuiManager;
import GUI.GuiMessenger;
import Game.Statistics;
import Game.Items.GameItem;
import Game.Objects.GOPlayer;
import Game.Objects.Creatures.GOCreature;
import Screens.MyScreens.GameScreen;
import Tools.SoundManager;
import Tools.Drawing.FontTagSystem;

/** Magic Potion
 * Adds 25 magic
 * @author Aikidos
 */
public class GIMagicPotion extends GameItem {

	// Stats
	private int _magic = 25;
	
	public GIMagicPotion() {
		super("Magic Potion");
		
		Category = ECategory.Potion;
		
		_isStackable = true;
		_weight = 0.05f;
	}

	@Override
	public boolean use() {
		if (_ownerGameObject.isPlayer()) {
			GOPlayer player = (GOPlayer) _ownerGameObject;
			
			player.Magic += _magic;
			
			// Remove from unknown list
			Statistics.removeUnknownItem(this);
			
			GuiManager.getMessenger().addMessage("[green]You[/green] drank a [yellow]"
					+ getName() + "[/yellow] (+" + String.valueOf(_magic)
					+ " magic)");
			
			// Play sound
			SoundManager.play("sfx_drink");
			
			return true;
		}
		
		return false;
	}
	
	@Override
	public void drawInfo(Vector2f drawPos, Graphics g) {
		
		if (Statistics.isUnknownItem(this)) {
			FontTagSystem.drawText("???", drawPos); return;
		}
		
		FontTagSystem.drawText("Description:", drawPos);
		
		drawPos.y += 20;
		
		FontTagSystem.drawText("Adds: [green]" 
				+ String.valueOf(_magic) + "[/red] magic", drawPos);
	}
	
	@Override
	public String getName() {
		
		if (Statistics.getUnknownItems().contains(this.getClass().getName()))
			return "??? Potion";
		
		return super.getName();
	}
	
}
